import logging

from redis import StrictRedis


class Config(object):
    SECRET_KEY = "dxVYJQZNmR6XVOyZxb5vwLxTlyGPYQThUtKBX7o5+MTHm4QsGlqbgL6m9b5yz8OT"

    SQLALCHEMY_DATABASE_URI = "mysql+mysqlconnector://root:123456@127.0.0.1:3306/flaskproject1"
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    REDIS_HOST = "127.0.0.1"
    REDIS_PORT = 6379

    SESSION_TYPE = "redis"
    SESSION_REDIS = StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
    SESSION_USE_SIGNER = True
    PERMANENT_SESSION_LIFETIME = 86400 * 2
    LOG_LEVEL = logging.DEBUG

class DevelopmentConfig(Config):
    '''开发者模式'''
    DEBUG = True

class ProductionCOnfig(Config):
    '''生产者模式'''
    DEBUG = False
    LOG_LEVEL = logging.ERROR


config_dict = {
    "development":DevelopmentConfig,
    "production":ProductionCOnfig
}